package com.sky.mapper;

import com.sky.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishFlavorMapper {
    /**
     * 动态批量插入Insert 口味表
     */
    void insertBatch(List<DishFlavor> flavors);

    @Delete("delete  from dish_flavor where id=#{id}")
    void deleteByDishId(Long id);

    void deleteByDishIds(List<Long> dishIds);

    void updateById(List<DishFlavor> dishFlavors);

    /**
     * 根据dish菜品id 查询 口味表
     * @param id
     * @return
     */
    @Select("select id,dish_id,name,value from dish_flavor df where dish_id=#{id}")
    List<DishFlavor> getByDishId(Long id);
}
